package exercise05;

public class Car extends Vehicle{
    public Car(double maxSpeed, double weight) {
        super(maxSpeed, weight);
        speed = 0;
    }

    @Override
    public void run(double speed) {
        if (speed > maxSpeed) {
            speed = maxSpeed;
        }
        this.speed = speed;
        System.out.println("小轿车正在运行，速度为：" + speed);
    }

    @Override
    public void stop() {
        this.speed = 0;
        System.out.println("小轿车停止，速度为：" + speed);
    }

}

